﻿@model ThaireInvestmentWeb.Models.ManageDepositModel
@{
    ViewBag.Title = "ManageDeposit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
    $(document).ready(function () {
        $("#ResetBtn").click(function (event) {
            showConfirm(null, ResetBtnAction);
            return false;
        });

    });
    function ResetBtnAction(event) {
        window.location.href = 'ManageDeposit';
    }
</script>
<table class="navi" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td style="width: 100%;">
            <div class="navi">
                Instrument Type > Deposit at Financial Institutions
          
            </div>
        </td>
    </tr>
</table>

<table class="tableheader" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td height="38" align="center" style="width: 100%; text-align: center;">Deposit at Financial Institutions</td>
    </tr>
</table>
<table width="951" border="0" align="center">
    <tr>
        <td>
            @*using (Html.BeginForm("SearchDepositHeader", "Deposit", FormMethod.Post, new { id = "mainForm" }))*@
            @using (Html.BeginForm())
            {
               
                <table class="tableform" width="100%" border="5" align="center" cellspacing="2" style="background-color: #E8ECFF;">
                    <tr>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="width: 236px; height: 4px;"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                    </tr>
                    <tr>
                        <td width="212">
                            <div align="right">
                                Company <span class="error">*</span> :&nbsp;
                            </div>
                        </td>
                        <td>&nbsp;
                        </td>
                        <td style="width: 236px" align="left">
                            @Html.DropDownListFor(x => x.SelectedCompany, Model.CompanyList)

                        </td>
                        <td width="188">@Html.ValidationMessageFor(model => model.SelectedCompany)</td>
                        <td>&nbsp;
                        </td>
                        <td width="208"></td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">
                                Asset Class :&nbsp;
                            </div>
                        </td>
                        <td>&nbsp;
                        </td>
                        <td style="width: 236px" align="left">
                            @Html.DropDownListFor(x => x.SelectedDepositType, Model.DepositTypeList)

                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">
                                Fianancial Instrument :&nbsp;
                            </div>
                        </td>
                        <td>&nbsp;
                        </td>
                        <td style="width: 236px" align="left">
                            @Html.DropDownListFor(x => x.SelectedFinanceType, Model.FinanceTypeList)

                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">
                                Bank :&nbsp;
                            </div>
                        </td>
                        <td>&nbsp;
                        </td>
                        <td style="width: 236px" align="left">
                            @Html.DropDownListFor(x => x.SelectedBank, Model.BankList)

                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="background-color: #E8ECFF">
                            <div align="right">
                                A/C No, Voucher No. :&nbsp;
                            </div>
                        </td>
                        <td style="background-color: #E8ECFF">&nbsp;
                        </td>
                        <td style="width: 236px; background-color: #E8ECFF;">
                            @Html.EditorFor(model => model.AccountVoucherNO)
                        </td>
                        <td style="background-color: #E8ECFF">&nbsp;
                        </td>
                        <td style="background-color: #E8ECFF">&nbsp;
                        </td>
                        <td style="background-color: #E8ECFF">&nbsp;
                        </td>
                    </tr>
                   

                    <tr>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td style="width: 236px">&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;
                        </td>
                        <td>&nbsp;

                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="text-align: center">@Html.ValidationSummary(true)</td>
                    </tr>
                    <tr>
                        <td colspan="6" style="text-align: center">
                            <input type="submit" name="SearchBtn" value=" Search " class="button">&nbsp;&nbsp;&nbsp;
                            <input  type="button" id="ResetBtn" name="ResetBtn" value=" Reset " class="button"/> 
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="width: 236px; height: 4px;"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                    </tr>
                </table>
             
            }
            <table width="95%" border="0" align="center">
                <tr>
                    <td>
                        <div align="left">
                            <input type="button" name="Submit22" value=" New " class="button" onclick="self.location.href = 'EditDepositHeader';">
                            &nbsp;&nbsp;&nbsp;
                        </div>
                    </td>
                    <td>
                        <div align="right">
                            &nbsp;
                        </div>
                    </td>
                </tr>
            </table>
            @{
 
                if (Model.HeaderAdaps != null)
                {
                    var grid = new WebGrid(source: Model.HeaderAdaps, ajaxUpdateContainerId: "grid", rowsPerPage: 25);
                     @grid.GetHtml(htmlAttributes: new { id = "grid" }, tableStyle: "tablelist", headerStyle: "headertable", displayHeader: @Model.HeaderAdaps.Count > 0,
                      columns: grid.Columns(
                                grid.Column(header: "NO.", format: item => (item.WebGrid.Rows.IndexOf(item) + 1) + (grid.PageIndex * grid.RowsPerPage), canSort: false),

                                grid.Column(columnName: "Company", header: "Company", canSort: false),
                                grid.Column(columnName: "DepositType", header: "Deposit Type", canSort: false),
                                grid.Column(columnName: "FinanceInstrumentType", header: "Fianancial Instrument", canSort: false),
                                grid.Column(columnName: "BankName", header: "Bank Name", canSort: false),
                                grid.Column(columnName: "AccountVoucherNO", header: "A/C No, Voucher No.", canSort: false),
                                grid.Column(header: "Detail", style: "table_col15", format:
                                    @<text>
                                    <input type="image" onClick="go('@Url.Action("EditDepositHeader", "Deposit", new { headerId = item.DepositHeaderID })    ');"  src="@Url.Content("~/Content/images/b_edit.gif")"  title="แก้ไข">
                                    </text>)
                        ));
                }
            }

        </td>
    </tr>
</table>
